#include <iostream>       // std::cout
#include <future>         // std::async, std::future
#include <thread>
#include <chrono>

int get_value(int x,int y) 
{ 
    std::cout<<x+y<<std::endl;
    return x+y; 
}

int main ()
{
    std::future<int> foo;                            // default-constructed
    std::future<int> bar = std::async(std::launch::async,get_value,2,3);   // move-constructed


    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::cout << "--------------------------------------"<< '\n';
    int x = bar.get();

    std::this_thread::sleep_for(std::chrono::seconds(1));

    std::cout << "--------------------------------------"<< '\n';

    std::cout << "value: " << x << '\n';

    return 0;
}